#include "..\StdAfx.h"
#include "GDialog.h"

GDialog::GDialog(void)
: m_pBaseSprite(NULL)
, m_pBaseTexture(NULL)
{
}

GDialog::~GDialog(void)
{
	if (m_pBaseTexture != NULL)
		m_pBaseTexture->Release();

	if (m_pBaseSprite != NULL)
		m_pBaseSprite->Release();
}

void GDialog::Init(LPDIRECT3DDEVICE9 pd3ddev9)
{
	D3DXCreateSprite(pd3ddev9, &m_pBaseSprite);

	UINT		Width = DXG::s_nWidth;
	UINT		Height = 30;
	UINT		MipLevels = 0;
	DWORD		Usage = 0;
	D3DFORMAT	Format = D3DFMT_UNKNOWN;
	D3DPOOL		Pool = D3DPOOL_DEFAULT;

	D3DXCreateTexture(pd3ddev9, Width, Height, MipLevels, Usage, Format, Pool, &m_pBaseTexture);
}

void GDialog::Show(LPDIRECT3DDEVICE9 pd3ddev9)
{
	D3DCOLOR color = D3DCOLOR_ARGB(0x7F, 0xFF, 0x00, 0x00);

	if (SUCCEEDED( m_pBaseSprite->Begin(D3DXSPRITE_ALPHABLEND) ))
	{
		m_pBaseSprite->Draw(m_pBaseTexture, NULL, NULL, NULL, color);

		m_pBaseSprite->End();
	}
}

GDialog* pDialog = NULL;